package com.ccp.dev.system.model;

import com.ccp.dev.core.basic.model.BaseModel;
import com.ccp.dev.system.util.XmlDateAdapter;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Arrays;
import java.util.Date;

/**
 * sysFile Model对象
 *
 * @author caishaofan
 */
@SuppressWarnings("serial")
@XmlRootElement(name="sysFile")
@XmlAccessorType(XmlAccessType.NONE)
public class SysFile extends BaseModel {

	public static final String PASSWORD_PROJECT_NAME = "FHBE_CASIC";
	public static final String ENCRYPT_FILE_SUR_FIX = "FE";
	/** 加密*/
	public static final short ENCRYPTED_YES = 1;
	/** 不加密*/
	public static final short ENCRYPTED_NO = 0;

	public static final String SAVETYPE_DATABASE = "database";


	/**
	 * 文件已经删除 [value=1]
	 */
	public static Short FILE_DEL = 1;
	
	/**
	 * 文件存在[value=0]
	 */
	public static Short FILE_NOT_DEL = 0;
	
	/**
	 * 匿名用户
	 */
	public static String FILE_UPLOAD_UNKNOWN = "unknown";
	
	/**
	 * 其他分类
	 */
	public static String FILETYPE_OTHERS="others";
	

	public static final String ATTACHMENT_DIRECTORY="attachFiles";

	public static final String EXCELFORM_TEMPLATE_DIRECTORY="excelTemplateFiles";

	/** fileId*/
	@XmlAttribute
	protected String fileId;

	/** 分类ID*/
	@XmlAttribute
	protected String typeId;

	/** 文件名*/
	@XmlAttribute
	protected String fileName;

	/** 文件路径*/
	@XmlAttribute
	protected String filePath;

	/** 创建时间*/
	@XmlJavaTypeAdapter(XmlDateAdapter.class)
	@XmlAttribute
	protected Date createtime;

	/** 扩展名*/
	@XmlAttribute
	protected String ext;

	/** 附件类型*/
	@XmlAttribute
	protected String fileType;

	/** 说明*/
	@XmlAttribute
	protected String note;

	/** creatorId*/
	@XmlAttribute
	protected String creatorId;

	/** 上传者*/
	@XmlAttribute
	protected String creator;

	/** totalBytes*/
	@XmlAttribute
	protected Long totalBytes;

	/** 1=已删除*/
	@XmlAttribute
	protected Short delFlag;

	/** 附件内容*/
	@XmlAttribute
	protected byte[]  fileBlob;

	protected String typeName;

	/** 多租户*/
	@XmlAttribute
	protected String tenantId;

	/** 是否加密*/
	@XmlAttribute
	protected  short encrypted;

	/** 附件密级*/
	protected  int fileLevel;


	public String getFileId() {
		return fileId;
	}

	public void setFileId(String fileId) {
		this.fileId = fileId;
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public String getExt() {
		return ext;
	}

	public void setExt(String ext) {
		this.ext = ext;
	}

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(String creatorId) {
		this.creatorId = creatorId;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public Long getTotalBytes() {
		return totalBytes;
	}

	public void setTotalBytes(Long totalBytes) {
		this.totalBytes = totalBytes;
	}

	public Short getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(Short delFlag) {
		this.delFlag = delFlag;
	}

	public byte[] getFileBlob() {
		return fileBlob;
	}

	public void setFileBlob(byte[] fileBlob) {
		this.fileBlob = fileBlob;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	@Override
	public String getTenantId() {
		return tenantId;
	}

	@Override
	public void setTenantId(String tenantId) {
		this.tenantId = tenantId;
	}

	public short getEncrypted() {
		return encrypted;
	}

	public void setEncrypted(short encrypted) {
		this.encrypted = encrypted;
	}

	public int getFileLevel() {
		return fileLevel;
	}

	public void setFileLevel(int fileLevel) {
		this.fileLevel = fileLevel;
	}

	@Override
	public String toString() {
		return "SysFile{" +
				"fileId='" + fileId + '\'' +
				", typeId='" + typeId + '\'' +
				", fileName='" + fileName + '\'' +
				", filePath='" + filePath + '\'' +
				", createtime=" + createtime +
				", ext='" + ext + '\'' +
				", fileType='" + fileType + '\'' +
				", note='" + note + '\'' +
				", creatorId='" + creatorId + '\'' +
				", creator='" + creator + '\'' +
				", totalBytes=" + totalBytes +
				", delFlag=" + delFlag +
				", fileBlob=" + Arrays.toString(fileBlob) +
				", typeName='" + typeName + '\'' +
				", tenantId='" + tenantId + '\'' +
				", encrypted=" + encrypted +
				", fileLevel=" + fileLevel +
				'}';
	}
}